public class Student {
    private int id;
    private String name;
    private int age;

    public void setId(int id){
        this.id=id;
    }
    public int getId(){
        return id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) throws AgeException {
        if(age<=25&&age>=18) {this.age = age;}
        else {throw new AgeException("输入的年龄太大或太小");}
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }


    public void eat(){
        System.out.println("大口吃");
    }
    public void sleep(){
        System.out.println("呼呼大睡");
    }
    public Student(int id, int age, String name) throws AgeException {
        setId(id);
        setAge(age);
        setName(name);
    }
    public Student(){

    }
}

class AgeException extends Exception{
    public AgeException() {
        super();
    }
    public AgeException(String s) {
        super(s);
    }

}